package com.feign.interceptor;

import feign.RequestInterceptor;
import feign.RequestTemplate;
import lombok.extern.slf4j.Slf4j;

/**
 * @作者: 林江
 * @创建时间: 2023/10/29
 * @功能: feign调用的时候，携带token到提供方
 */
@Slf4j
public class FeignTokenInteceptor implements RequestInterceptor {

    @Override
    public void apply(RequestTemplate template) {
        log.info("feign调用携带token。。。。。。。。。。。");
//        ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
//        HttpServletRequest request = attributes.getRequest();
        template.header("token", "123456");
    }
}
